<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="com.electric.entity.CustomRepairRecord,com.electric.common.Contains"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ include file="/WEB-INF/jsp/common/common.jsp"%>
<% 
CustomRepairRecord repairRecord = (CustomRepairRecord) request.getAttribute("repairRecord");
String code = Contains.VOLTAGE_LOSS_CODE;
%>
<style>
	.upload-img{position: relative;overflow: hidden;height: 30px;}
	.upload-img input[type=file]{
		position: absolute;
		left: 0;
		top: 0;
		z-index: 10;
		opacity: 0;
		filter:Alpha(opacity=0);
		color: transparent;
		width: 100%;
		height: 30px;
		background:transparent;
	    cursor: pointer;
	    font-size: 50rem;
    }
    .controls .row-fluid{margin-bottom: 9px;}
    .img-row .controls .carousel .carousel-caption{display: none;}
    .img-row .controls .carousel:hover .carousel-caption{display: block;}
    .img-row .controls .carousel:hover .carousel-caption h4,.controls .carousel:hover .carousel-caption p{text-align: center;}
    
    #dataForm .control-group .control-label{width: 100px;}
    #dataForm .control-group .controls{margin-left: 120px;}
    
    .carousel .carousel-caption{ display: none; }
    .carousel:hover .carousel-caption{ display: block; }
    
    
    #dataForm #lossVoltageLevelParam .date input {width: 160px;}
    #dataForm #lossVoltageLevelParam .row-fluid{ margin-bottom: 10px;}
    #dataForm #lossVoltageLevelParam .control-label.span4{width: 31.914893617021278%;min-width: 64px;}
    #dataForm #lossVoltageLevelParam input{width: 100%;}
</style>

<form id="dataForm" class="form-horizontal" style="margin-top: 32px;" enctype="multipart/form-data">
	<div class="control-group info check-group">
      <label class="control-label" for="repairTypeData">故障类型</label>
      <div class="controls">
        <select class="check-required" id="repairTypeData" name="repairType">
        	<option value="">----</option>
		    <c:forEach items="${allRepairType }" var="c">
		    	<c:choose>
			    	<c:when test="${c.seqId eq repairRecord.repairType}">
			    		<option value="${c.seqId }" selected="selected">${c.repairType }</option>
			    	</c:when>
			    	<c:otherwise>
			    		<option value="${c.seqId }">${c.repairType }</option>
			    	</c:otherwise>
		    	</c:choose>
		    </c:forEach>
        </select>
        <span class="help-inline" style="display:none;color: #b94a48;"></span>
      </div>
    </div>
    <div class="control-group info check-group">
      <label class="control-label" for="voltageLevelData">电压等级</label>
      <div class="controls">
        <select class="check-required" id="voltageLevelData" name="voltageLevel">
        	<option value="">----</option>
		    <c:forEach items="${allVoltageLevel }" var="c">
		    	<c:choose>
			    	<c:when test="${c.seqId eq repairRecord.voltageLevel}">
			    		<option value="${c.seqId }" selected="selected">${c.value }</option>
			    	</c:when>
			    	<c:otherwise>
			    		<option value="${c.seqId }">${c.value }</option>
			    	</c:otherwise>
		    	</c:choose>
		    </c:forEach>
        </select>
        <span class="help-inline" style="display:none;color: #b94a48;"></span>
      </div>
    </div>
    <div class="control-group info check-group">
      <label class="control-label" for="customerNumberData">户号</label>
      <div class="controls">
      	<c:if test="${not empty repairRecord.customerNumberStr and not empty repairRecord.customerName}">
      		<c:set var="showCustomer" value="[${repairRecord.customerNumberStr }]${repairRecord.customerName }" />
      	</c:if>
      	<input class="disabled" type="text" id="customerNumberData" value="${showCustomer }" readonly="readonly" />
        <input class="check-required" type="hidden" name="customerNumber" value="${repairRecord.customerNumber}" />
        <span class="help-inline" style="display:none;color: #b94a48;"></span>
      </div>
    </div>
	<div class="control-group info check-group">
		<label class="control-label">故障日期</label>
		<div class="controls">
			<div class="input-append date" id="failureDate" data-date-format="yyyy-mm-dd">
				<fmt:formatDate value="${repairRecord.failureDate}"
					pattern="yyyy-MM-dd" var="failureDate" />
				<input class="check-required" name="failureDate" size="16"
					type="text" value="${failureDate}" readonly />
				<span class="add-on"><i class="icon-th"></i></span>
				<span class="add-on"><i class="icon-remove"></i></span>
			</div>
			<span class="help-inline" style="display:none;color: #b94a48;"></span>
		</div>
	</div>
    <div class="control-group info check-group">
      <label class="control-label">恢复日期</label>
      <div class="controls">
        <div class="input-append date" id="repairDate" data-date-format="yyyy-mm-dd">
        	<fmt:formatDate value="${repairRecord.repairDate}" pattern="yyyy-MM-dd" var="repairDate" /> 
		    <input class="check-required" name="repairDate" size="16" type="text" value="${repairDate}" readonly />
		    <span class="add-on"><i class="icon-th"></i></span>
		    <span class="add-on"><i class="icon-remove"></i></span>
	    </div>
        <span class="help-inline" style="display:none;color: #b94a48;"></span>
      </div>
    </div>
    <div class="control-group info check-group">
      <label class="control-label" for="repairResult">处理结果</label>
      <div class="controls">
        <textarea class="check-required" id="repairResult" name="repairResult" maxlength="300" style="height: 60px;">${repairRecord.repairResult }</textarea>
        <span class="help-inline" style="display:none;color: #b94a48;"></span>
      </div>
    </div>
	<%
	if(repairRecord != null && code.equals(Contains.REPAIR_TYPE_ID_CODE.get(repairRecord.getRepairType()))){
	%>
		<div class="control-group info" id="lossVoltageLevelParam">
	<%
	} else {
	%>
		<div class="control-group info hide" id="lossVoltageLevelParam">
	<%
	}
	%>
      <div class="row-fluid">
      	<div class="span12 check-group">
	      	<label class="control-label">失压前的日期1</label>
	        <div class="controls">
	          <div class="input-append date" id="beforeLossVoltageDate1" data-date-format="yyyy-mm-dd">
			    <input name="params[beforeLossVoltageDate1]" size="16" type="text" value="${repairRecordParameter.beforeLossVoltageDate1 }" readonly />
			    <span class="add-on"><i class="icon-th"></i></span>
			    <span class="add-on"><i class="icon-remove"></i></span>
	          </div>
	          <span class="help-inline" style="display:none;color: #b94a48;"></span>
	        </div>
        </div>
      </div>
      <div class="row-fluid">
      	<div class="span3 check-group">
	      	<label class="span4 control-label">[电量]总</label>
	        <div class="span7">
	          <input type="text" class="check-float" name="params[beforeLossVoltageTotal1]" value="${repairRecordParameter.beforeLossVoltageTotal1 }" maxlength="8" />
	          <span class="help-inline" style="display:none;color: #b94a48;"></span>
	        </div>
        </div>
        <div class="span3 check-group">
	      	<label class="span4 control-label">[电量]尖</label>
	        <div class="span7">
	          <input type="text" class="check-float" name="params[beforeLossVoltageSharp1]" value="${repairRecordParameter.beforeLossVoltageSharp1 }" maxlength="8" />
	          <span class="help-inline" style="display:none;color: #b94a48;"></span>
	        </div>
        </div>
        <div class="span3 check-group">
	      	<label class="span4 control-label">[电量]峰</label>
	        <div class="span7">
	          <input type="text" class="check-float" name="params[beforeLossVoltagePeak1]" value="${repairRecordParameter.beforeLossVoltagePeak1 }" maxlength="8" />
	          <span class="help-inline" style="display:none;color: #b94a48;"></span>
	        </div>
        </div>
        <div class="span3 check-group">
	      	<label class="span4 control-label">[电量]谷</label>
	        <div class="span7">
	          <input type="text" class="check-float" name="params[beforeLossVoltageOffPeak1]" value="${repairRecordParameter.beforeLossVoltageOffPeak1 }" maxlength="8" />
	          <span class="help-inline" style="display:none;color: #b94a48;"></span>
	        </div>
        </div>
      </div>
      
      <div class="row-fluid">
      	<div class="span12 check-group">
	      	<label class="control-label">失压前的日期2</label>
	        <div class="controls">
	          <div class="input-append date" id="beforeLossVoltageDate2" data-date-format="yyyy-mm-dd">
			    <input name="params[beforeLossVoltageDate2]" size="16" type="text" value="${repairRecordParameter.beforeLossVoltageDate2 }" readonly />
			    <span class="add-on"><i class="icon-th"></i></span>
			    <span class="add-on"><i class="icon-remove"></i></span>
	          </div>
	          <span class="help-inline" style="display:none;color: #b94a48;"></span>
	        </div>
        </div>
      </div>
      <div class="row-fluid">
      	<div class="span3 check-group">
	      	<label class="span4 control-label">[电量]总</label>
	        <div class="span7">
	          <input type="text" class="check-float" name="params[beforeLossVoltageTotal2]" value="${repairRecordParameter.beforeLossVoltageTotal2 }" maxlength="8" />
	          <span class="help-inline" style="display:none;color: #b94a48;"></span>
	        </div>
        </div>
        <div class="span3 check-group">
	      	<label class="span4 control-label">[电量]尖</label>
	        <div class="span7">
	          <input type="text" class="check-float" name="params[beforeLossVoltageSharp2]" value="${repairRecordParameter.beforeLossVoltageSharp2 }" maxlength="8" />
	          <span class="help-inline" style="display:none;color: #b94a48;"></span>
	        </div>
        </div>
        <div class="span3 check-group">
	      	<label class="span4 control-label">[电量]峰</label>
	        <div class="span7">
	          <input type="text" class="check-float" name="params[beforeLossVoltagePeak2]" value="${repairRecordParameter.beforeLossVoltagePeak2 }" maxlength="8" />
	          <span class="help-inline" style="display:none;color: #b94a48;"></span>
	        </div>
        </div>
        <div class="span3 check-group">
	      	<label class="span4 control-label">[电量]谷</label>
	        <div class="span7">
	          <input type="text" class="check-float" name="params[beforeLossVoltageOffPeak2]" value="${repairRecordParameter.beforeLossVoltageOffPeak2 }" maxlength="8" />
	          <span class="help-inline" style="display:none;color: #b94a48;"></span>
	        </div>
        </div>
      </div>
      
      <div class="row-fluid">
      	<div class="span12 check-group">
	      	<label class="control-label">恢复后的日期1</label>
	        <div class="controls">
	          <div class="input-append date" id="afterRepairDate1" data-date-format="yyyy-mm-dd">
			    <input name="params[afterRepairDate1]" size="16" type="text" value="${repairRecordParameter.afterRepairDate1 }" readonly />
			    <span class="add-on"><i class="icon-th"></i></span>
			    <span class="add-on"><i class="icon-remove"></i></span>
	          </div>
	          <span class="help-inline" style="display:none;color: #b94a48;"></span>
	        </div>
        </div>
      </div>
      <div class="row-fluid">
      	<div class="span3 check-group">
	      	<label class="span4 control-label">[电量]总</label>
	        <div class="span7">
	          <input type="text" class="check-float" name="params[afterRepairTotal1]" value="${repairRecordParameter.afterRepairTotal1 }" maxlength="8" />
	          <span class="help-inline" style="display:none;color: #b94a48;"></span>
	        </div>
        </div>
        <div class="span3 check-group">
	      	<label class="span4 control-label">[电量]尖</label>
	        <div class="span7">
	          <input type="text" class="check-float" name="params[afterRepairSharp1]" value="${repairRecordParameter.afterRepairSharp1 }" maxlength="8" />
	          <span class="help-inline" style="display:none;color: #b94a48;"></span>
	        </div>
        </div>
        <div class="span3 check-group">
	      	<label class="span4 control-label">[电量]峰</label>
	        <div class="span7">
	          <input type="text" class="check-float" name="params[afterRepairPeak1]" value="${repairRecordParameter.afterRepairPeak1 }" maxlength="8" />
	          <span class="help-inline" style="display:none;color: #b94a48;"></span>
	        </div>
        </div>
        <div class="span3 check-group">
	      	<label class="span4 control-label">[电量]谷</label>
	        <div class="span7">
	          <input type="text" class="check-float" name="params[afterRepairOffPeak1]" value="${repairRecordParameter.afterRepairOffPeak1 }" maxlength="8" />
	          <span class="help-inline" style="display:none;color: #b94a48;"></span>
	        </div>
        </div>
      </div>
      
      <div class="row-fluid">
      	<div class="span12 check-group">
	      	<label class="control-label">恢复后的日期2</label>
	        <div class="controls">
	          <div class="input-append date" id="afterRepairDate2" data-date-format="yyyy-mm-dd">
			    <input name="params[afterRepairDate2]" size="16" type="text" value="${repairRecordParameter.afterRepairDate2 }" readonly />
			    <span class="add-on"><i class="icon-th"></i></span>
			    <span class="add-on"><i class="icon-remove"></i></span>
	          </div>
	          <span class="help-inline" style="display:none;color: #b94a48;"></span>
	        </div>
        </div>
      </div>
      <div class="row-fluid">
      	<div class="span3 check-group">
	      	<label class="span4 control-label">[电量]总</label>
	        <div class="span7">
	          <input type="text" class="check-float" name="params[afterRepairTotal2]" value="${repairRecordParameter.afterRepairTotal2 }" maxlength="8" />
	          <span class="help-inline" style="display:none;color: #b94a48;"></span>
	        </div>
        </div>
        <div class="span3 check-group">
	      	<label class="span4 control-label">[电量]尖</label>
	        <div class="span7">
	          <input type="text" class="check-float" name="params[afterRepairSharp2]" value="${repairRecordParameter.afterRepairSharp2 }" maxlength="8" />
	          <span class="help-inline" style="display:none;color: #b94a48;"></span>
	        </div>
        </div>
        <div class="span3 check-group">
	      	<label class="span4 control-label">[电量]峰</label>
	        <div class="span7">
	          <input type="text" class="check-float" name="params[afterRepairPeak2]" value="${repairRecordParameter.afterRepairPeak2 }" maxlength="8" />
	          <span class="help-inline" style="display:none;color: #b94a48;"></span>
	        </div>
        </div>
        <div class="span3 check-group">
	      	<label class="span4 control-label">[电量]谷</label>
	        <div class="span7">
	          <input type="text" class="check-float" name="params[afterRepairOffPeak2]" value="${repairRecordParameter.afterRepairOffPeak2 }" maxlength="8" />
	          <span class="help-inline" style="display:none;color: #b94a48;"></span>
	        </div>
        </div>
      </div>
      <div class="row-fluid">
      	<div class="span5 check-group">
	      	<label class="span4 control-label">CT倍率</label>
	        <div class="span7">
	          <input type="text" class="check-float" name="params[CTRatio]" value="${repairRecordParameter.CTRatio }" maxlength="8" />
	          <span class="help-inline" style="display:none;color: #b94a48;"></span>
	        </div>
        </div>
        <div class="span5 check-group">
	      	<label class="span4 control-label">PT倍率</label>
	        <div class="span7">
	          <input type="text" class="check-float" name="params[PTRatio]" value="${repairRecordParameter.PTRatio }" maxlength="8" />
	          <span class="help-inline" style="display:none;color: #b94a48;"></span>
	        </div>
        </div>
       </div>
       
       <div class="row-fluid">
      	<div class="span12">
	      	<label class="control-label" style="width: 100%;text-align: left;margin-left: 5px;">失压期间后追补电量</label>
        </div>
      </div>
      <div id="calculateResult">
      <div class="row-fluid">
      	<div class="span3">
	      	<label class="span4 control-label">[电量]总</label>
	        <div class="span7">
	          <input type="text" value="${calculateParameter.resultArray[0] }" disabled />
	        </div>
        </div>
      </div>
      <div class="row-fluid">
        <div class="span3">
	      	<label class="span4 control-label">[电量]尖</label>
	        <div class="span7">
	          <input type="text" value="${calculateParameter.resultArray[1] }" disabled />
	        </div>
        </div>
        <div class="span3">
	      	<label class="span4 control-label">[电量]峰</label>
	        <div class="span7">
	          <input type="text" value="${calculateParameter.resultArray[2] }" disabled />
	        </div>
        </div>
        <div class="span3">
	      	<label class="span4 control-label">[电量]谷</label>
	        <div class="span7">
	          <input type="text" value="${calculateParameter.resultArray[3] }" disabled />
	        </div>
        </div>
        <div class="span3">
	      	<label class="span4 control-label">[电量]平</label>
	        <div class="span7">
	          <input type="text" value="${calculateParameter.resultArray[4] }" disabled />
	        </div>
        </div>
      </div>
      </div>
    </div>
    <div class="control-group info">
   		<label class="control-label">现场图片</label>
		<div class="controls">
			<div class="row-fluid">
				<div class="span6 upload-img" style="">
					<label class="btn" for="imageupload" style="z-index: 11;">
						<i class="icon-upload"></i>上传图片
					</label>
					<input id="imageupload" name="file" type="file" multiple="multiple" style="width: 100%;font-size: 999px;"
						accept="image/bmp,image/gif,image/pipeg,image/jpeg,image/svg+xml,image/x-portable-anymap,image/x-portable-bitmap,image/x-rgb" />
					<code>请上传大小10M以内的图片文件。</code>
				</div>
				<div class="span5 hide" id="imageBar">
					<div class="progress progress-info" style="margin-top: 9px;">
						<div class="bar" id="imageProcessBar" style="width: 0%"></div>
					</div>
				</div>
			</div>
			<c:if test="${empty repairRecord.pictures}">
				<div class="row-fluid img-row"></div>
			</c:if>
			<c:forEach items="${repairRecord.pictures}" var="c" varStatus="s">
				<c:if test="${s.index % 3 eq 0}">
				<div class="row-fluid img-row">
				</c:if>
				
				<div class="span4 carousel">
					<img class="featurette-image pull-left" src="${basePath }/${c.filePath}">
					<div class="carousel-caption">
				        <h4 class="one-line">${c.fileName}</h4>
				        <p>
					        <div class="btn-group" style="margin: 9px 0 5px;">
								<span class="btn" onclick="openImage(this)">查看原图</span>
								<a class="btn" href="${basePath}/${c.filePath}" target="_blank">在新窗口打开</a>
								<span class="btn" onclick="delImage(this,'${c.seqId}')">删除图片</span>
								<input type="hidden" name="imgSeqIds" value="${c.seqId }" />
							</div>
				        </p>
			        </div>
				</div>
				
				<c:if test="${(s.index + 1) % 3 eq 0 or s.last}">
				</div>
				</c:if>
			</c:forEach>
    	</div>
    </div>
    <input type="hidden" name="seqId" value="${repairRecord.seqId }" />
</form>

<script type="text/javascript">
	$(function(){
		// 接收图片文件
		$('#imageupload').fileupload({
			url: basePath + "/uploadImages",
			autoUpload: true,
			iframe : true,
			maxNumberOfFiles : 3,
			dataType :'iframe text',
            forceIframeTransport: true,
			add : function(e, data) {
				if (data.files[0].size > 1024*1024*10) {
					 window.layer.alert('上传文件大于10M！', {
						icon : 5
					});
					return;
				}
				
				if(data.files[0].name.length > 80){
					window.layer.alert('该文件名太长，请修改后再重试！', {
						icon : 5
					});
					return;
				}
				data.process().done(function() {
					$('#imageBar').fadeIn();
					data.submit();
				});
			},
			progressall : function(e, data) {
				var progress = parseInt(data.loaded / data.total* 100, 10);
				$('#imageProcessBar').css('width', progress + '%');
				$('#imageProcessBar').text(progress + '%');
			},
			done:function(e,data){
				$('#imageBar').fadeOut();
				
				if(data && data.result) {
					data.result = eval("("+data.result+")");
					for(var ri = 0;ri < data.result.length;ri++){
						var html = createImgContent(data.result[ri].id,data.result[ri].fileName,data.result[ri].url);
						
						var imgRow = $(".img-row");
						
						if(imgRow.last().find(".carousel").length < 3){
							imgRow.last().append(html);
						}
						else{
							imgRow.last().after('<div class="row-fluid img-row">' + html + '</div>');
						}
					}
					
					layer.msg("上传成功", {
						time: 1000,
					    icon: 1,
					    skin: 'layer-ext-moon'
					});
				} else {
					layer.msg("上传失败", {
						time: 2000,
					    icon: 2,
					    skin: 'layer-ext-moon'
					});
				}
			}
		});
		
		var createImgContent = function(imageId,imageName,imgSrc){
			var html = '<div class="span4 carousel">';
			html += '<img class="featurette-image pull-left" src="' + basePath + '/' + imgSrc + '">';
			html += '<div class="carousel-caption">';
	        html += '<h4 class="one-line">' + imageName + '</h4>';
	        html += '<p>';
	        html += '<div class="btn-group" style="margin: 9px 0 5px;">';
			html += '<span class="btn" onclick="openImage(this)">查看原图</span>';
			html += '<a class="btn" href="' + basePath + '/' + imgSrc + '" target="_blank">在新窗口打开</a>';
			html += '<span class="btn" onclick="delImage(this,\'' + imageId + '\')">删除图片</span>';
			html += '<input type="hidden" name="imgSeqIds" value="' + imageId + '" />';
			html += '</div>';
	        html += '</p>';
	        html += '</div>';
			html += '</div>';
			return html;
		};
		
		$("#customerNumberData").bind("click",function(){
			chooseCustomer();
		});
		
		$('#failureDate').datetimepicker({
			language: 'zh-CN',
	        weekStart: 1,
	        todayBtn:  1,
			autoclose: 1,
			todayHighlight: 1,
			startView: 2,
			minView: 2,
			forceParse: 0
	    });
		
		$('#repairDate').datetimepicker({
			language: 'zh-CN',
	        weekStart: 1,
	        todayBtn:  1,
			autoclose: 1,
			todayHighlight: 1,
			startView: 2,
			minView: 2,
			forceParse: 0
	    });
		
		$('#beforeLossVoltageDate1').datetimepicker({
			language: 'zh-CN',
	        weekStart: 1,
	        todayBtn:  1,
			autoclose: 1,
			todayHighlight: 1,
			startView: 2,
			minView: 2,
			forceParse: 0
	    });
		
		$('#beforeLossVoltageDate2').datetimepicker({
			language: 'zh-CN',
	        weekStart: 1,
	        todayBtn:  1,
			autoclose: 1,
			todayHighlight: 1,
			startView: 2,
			minView: 2,
			forceParse: 0
	    });
		
		$('#afterRepairDate1').datetimepicker({
			language: 'zh-CN',
	        weekStart: 1,
	        todayBtn:  1,
			autoclose: 1,
			todayHighlight: 1,
			startView: 2,
			minView: 2,
			forceParse: 0
	    });
		
		$('#afterRepairDate2').datetimepicker({
			language: 'zh-CN',
	        weekStart: 1,
	        todayBtn:  1,
			autoclose: 1,
			todayHighlight: 1,
			startView: 2,
			minView: 2,
			forceParse: 0
	    });
		
		
		$("#repairTypeData").bind("change",function(){
			if(this.value == "<%=com.electric.common.Contains.REPAIR_TYPE_CODE_ID.get(com.electric.common.Contains.VOLTAGE_LOSS_CODE) %>"){
				$("#lossVoltageLevelParam").slideDown();
			}
			else{
				$("#lossVoltageLevelParam").slideUp();
			}
		});
	});
	
	function openImage(obj){
		var img = $(obj).parents(".carousel").eq(0).find("img");
		var originImg = document.createElement("img");
		originImg.src = $(img).attr('src');
		var width = originImg.width < $("#contentDiv").width() ? originImg.width : $("#contentDiv").width();
		layer.open({
		  type: 1,
		  title: false,
		  closeBtn: 0,
		  area: width + 'px',
		  skin: 'layui-layer-nobg', //没有背景色
		  shadeClose: true,
		  content: '<img src='+ originImg.src +' />'
		});
	}

	function delImage(obj,imageId){
		layer.confirm('确定删除该图片吗？', {btn: ['确定','取消'] , icon:3 }, 
		function(){
			var ll = layer.load();
			$.ajax({
				url : "${basePath}/repairRecord/delAttachment",
				method: 'POST',
				data : {
					"imageId":imageId
				},
				dataType : 'html',
				success : function(data) {
					if(data == "true" || data == true){
						var row = $(obj).closest(".img-row");
						var nextRow = row.nextAll(".img-row");
						$(obj).closest(".carousel").remove();
						
						if(nextRow.length > 0){
							row.append(nextRow.eq(0).find(".carousel")[0]);
						}
						
						for(var i = 0;i < nextRow.length;i++){
							if((i + 1) == nextRow.length){
								if(nextRow.eq(i).find(".carousel").length == 0){
									nextRow.eq(i).remove();
								}
							}
							else{
								nextRow.eq(i).append(nextRow.eq(i+1).find(".carousel")[0]);
							}
						}
						
						layer.close(ll);
						layer.msg("删除成功", {icon: 1});
					}
					else{
						layer.close(ll);
						layer.msg("删除失败", {icon: 2});
					}
				},
				error : function(){
					layer.close(ll);
					layer.msg("连接服务器时遇到错误！", {icon: 2});
				}
			});
		});
	}
</script>